<template>
  <div>
    <!-- 日志列表 -->
    <div>
      <el-table
        ref="multipleTable"
        :data="logList"
        stripe
         height="900"
        border
        @selection-change="handleSelectionChange"
        style="width: 100%"
        slot="scope"
      >
        <el-table-column type="selection" width="55"> </el-table-column>
        <el-table-column prop="logid" label="编号" width="">
        </el-table-column>
        <el-table-column prop="visitorip" label="IP地址" width="">
        </el-table-column>
        <el-table-column prop="vistitortime" label="时间" width="">
        </el-table-column>
        <el-table-column prop="visitorclass" label="Controller" width="450">
        </el-table-column>
        <el-table-column prop="visitormethod" label="方法" width="">
        </el-table-column>
        <el-table-column prop="other" label="备注" width="">
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>

<script>
import {
  // 获取日志表
  getLogs,
} from "@/api/log";
export default {
  name: "log",
  data() {
    return {
      // 日志信息数据
      logList: [],
      //复选框
      multipleSelection: [],
    };
  },
  // 钩子函数
  mounted() {
    this.getData();
  },
  methods: {
    getData() {
      //获取表格
      getLogs().then((res) => {
        this.logList = res.data;
      });
    },
    // 复选框
    toggleSelection(rows) {
      if (rows) {
        rows.forEach((row) => {
          this.$refs.multipleTable.toggleRowSelection(row);
        });
      } else {
        this.$refs.multipleTable.clearSelection();
      }
    },
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
  },
};
</script>

<style>
/* hello，I love you */
</style>